﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;

namespace WPFCommon.Logger
{
    public class SimpleCsvLogger
    {
        public string HeaderLine { get; set; }
        public string LogPath { get; set; }

        public void Log(IEnumerable<double> data, string [] otherContents = null)
        {
            var dataLine = string.Join(",", data);
            if (otherContents != null) dataLine = dataLine + string.Join(",", otherContents);

            if(!File.Exists(LogPath)) File.WriteAllLines(LogPath, new []{HeaderLine});
      
            File.AppendAllLines(LogPath, new []{dataLine});
        }
    }
}